﻿import QtQuick 2.12
import QtQuick.Controls 2.12
import QtGraphicalEffects 1.14

// 包含Title和Content的上下结构标签

Control {

    id: root

    height: 80*dp
    width: 180*dp

    property string title: "标题"
    property string content: "内容"

    padding: 15*dp

    property real title_size: config.fontsize + 1*dp
    property real content_size: config.fontsize
    property bool title_bold: false
    property bool content_bold: false
    property color title_color: "#333333"
    property color content_color: "#333333"
    property var textHAlign: Text.AlignLeft

    // 背景
    background: Rectangle{
        id: rect_bg
        radius: 5*dp
        border.color: "#EFEFEF"
        // 阴影
        layer.enabled: true
        layer.effect: DropShadow {
            radius: 22*dp
            samples: 43
            transparentBorder: true
            color: "#12444444"
        }
    }

    contentItem: Item{
        Text{
            id: text_title
            text: title
            font.pixelSize: title_size
            font.bold: title_bold
            color: title_color
            width: parent.width
            height: title_size
            verticalAlignment: Text.AlignVCenter
            horizontalAlignment: textHAlign
        }
        Text{
            id: text_content
            y: parent.height - height
            text: content
            font.pixelSize: content_size
            font.bold: content_bold
            color: content_color
            width: parent.width
            height: content_size
            verticalAlignment: Text.AlignVCenter
            horizontalAlignment: textHAlign
        }
    }


}
